package nuaa.service;

import nuaa.dao.IUserAndGroupDao;
import nuaa.util.UtilSqlSession;

import java.io.IOException;


public class UserAndGroupService {
    /*维护dao层对象*/
    private IUserAndGroupDao userAndGroupDao=UtilSqlSession.getSqlSession().getMapper(IUserAndGroupDao.class);

    public UserAndGroupService() throws IOException {
    }

    /**
     * 向数据库中添加新的记录，并直接提交
     * @param userId
     * @param groupId
     */
    public void add(Integer userId,Integer groupId) throws IOException {
        userAndGroupDao.add(userId,groupId);
        //提交
        System.out.println("提交了新的userandgroup记录");
        UtilSqlSession.getSqlSession().commit();
    }
}
